#define  _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

struct ListNode
{
    int val;
    ListNode* next;

    ListNode(int _val = 0)
    {
        val = _val;
        next = nullptr;
    }
};

ListNode* inputList(int n)
{
    ListNode* head = nullptr;
    ListNode* cur = nullptr;

    while (n--) {
        int val;
        cin >> val;

        if (head == nullptr) {
            head = new ListNode(val);
            cur = head;
        }
        else {
            cur->next = new ListNode(val);
            cur = cur->next;
        }
    }

    return head;
}

ListNode* RemoveMiddleNode(ListNode* head, int n)
{
    if (n == 1) {
        return head;
    }

    if (n == 2) {
        auto pre = head;
        head = head->next;

        delete pre;
        pre = nullptr;

        return head;
    }

    auto pre = head;
    auto cur = head->next->next;

    while (cur->next != nullptr && cur->next->next != nullptr) {
        pre = pre->next;
        cur = cur->next->next;
    }

    auto del = pre->next;
    pre->next = pre->next->next;

    delete del;
    del = nullptr;

    return head;
}

int main()
{
    int n, m;
    cin >> n >> m;

    auto head = inputList(n);
    head = RemoveMiddleNode(head, n);

    while (head != nullptr) {
        cout << head->val << " ";
        head = head->next;
    }

    return 0;
}